#include<iostream>
//模版方法模式
class Drink
{
public:
    //烧水
   virtual void Boil() = 0;
   //放入原料
   virtual void Brew() = 0;
   //搅拌
   virtual void Pour() = 0;
   void MakeDrink()
   {
       Boil();
       Brew();
       Pour();
   }
};
//必须实现所以的纯虚函数，才能实例化对象
class MilkTea :public Drink
{
public:
    void Boil()
    {
        std::cout << "热牛奶" << std::endl;
    }
    void Brew()
    {
        std::cout << "倒入珍珠" << std::endl;
    }
    void Pour()
    {
        std::cout << "用吸管搅拌" << std::endl;
    }
};
class coffee :public Drink
{
public:
    void Boil()
    {
        std::cout << "烧水" << std::endl;
    }
    void Brew()
    {
        std::cout << "倒入咖啡粉" << std::endl;
    }
    void Pour()
    {
        std::cout << "用勺子搅拌" << std::endl;
    }
};
int main()
{
    Drink *d = new MilkTea;
    d = new coffee;
    d->MakeDrink();
    return 0;
}